package exceptionTest;

import java.util.Scanner;

public class LoginTest {
    public static void main(String[] args) throws LoginException {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入账号(admin)");
        String qq = scanner.nextLine();
        if(!"admin".equals(qq)){
            System.out.println("账号不正确");
            throw new LoginException("账号不正确");
        }
        System.out.println("请输入密码(123)");
        String pwd = scanner.nextLine();
        if(!"123".equals(pwd)){
            throw new LoginException("密码错误");
        }
        System.out.println("登录成功");
    }
}
